#!/usr/bin/env python
# coding: utf-8
#coding=utf8
import sys
import re
reload(sys)
sys.setdefaultencoding('utf-8')
import httplib
import json
from wxbot import *
'''
url = u'http://youqu.slavpark.com/extra/movmsg_get.php?name=你好'
#使用HTTP获得连接
conn = httplib.HTTPConnection(u'youqu.slavpark.com')
#使用Get方式
conn.request(method='GET', url=url)
#请求得到返回的Respose
response = conn.getresponse()
#读取Respose的返回数据
res = response.read()
print res
'''

#self.send_msg_by_uid(u'hi', msg['user']['id'])
#self.send_img_msg_by_uid("img/1.png", msg['user']['id'])
#self.send_file_msg_by_uid("img/1.png", msg['user']['id'])
'''
contentmsg=u'代帅卿邀请"白小糖@观影助手"加入了群聊'
helper = re.findall(u'邀请\"(.*)\"加入', contentmsg)
str_convert = ''.join(helper)
print str_convert

relink = '<a href="(.*)">(.*)</a>'
info = '<a href="http://www.baidu.com">baidu</a>'
cinfo = re.findall(relink,info)
print cinfo
'''
'''
import time

print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()
'''

import re
string1 = 'http://bbs.csdn.net/topics/330059734'
string2 = 'http://www.runoob.com'
p = re.compile(r'^(https?://\w+(?:\.[^\.]+)+(?:/.+)*)?#?((?:/[^/]+)*)$')
result1 = p.findall(string1)
if result1:
    print result1
result2 = p.findall(string2)
if result2:
    print result2
'''
str="http://www.runoob.com/python/att-time-sleep.html"    #用'##'表示分隔符
match = re.match('^(http(s?)://.*?)##(.*)$',str)
if match == None:          #这是string中不含有URL的情况
    str2=str
    print str2
else:                      #这是string中含有URL的情况，但是这个URL是以http或者https开头，其他的没考虑进去。另外URL是不是合法的，没有检测，不知道楼主要不要检测
    a=match.group(1)
    b=match.group(3)
    print a,b
'''